package com.lmt_29;

import org.junit.*;

import java.io.IOException;
import java.net.Socket;

/**
 *
 */
public class JunitTest {
    private Socket socket;
    @Test
    public void testPrintNumber(){
        StringUtil.printNumber("admin");
        StringUtil.printNumber(null);
    }
    @Test
    public  void testMaxLength(){
        int index = StringUtil.maxLength("sddd");
        System.out.println(index);
        int length = StringUtil.maxLength(null);
        System.out.println(length);
        Assert.assertEquals("方法内部有bug",4,index);
    }
    @Before // 在所有静态方法执行之前执行一次
    public void test(){
        socket = new Socket();
        System.out.println("444444444444");
    }
    @After
    public void test1() throws Exception {
        socket.close();
        System.out.println("888888888888");
    }
    @BeforeClass
    public static void test11(){
        System.out.println("88888899999999888888");
    }
}
